# 请在此输入您的代码
t = int(input())


def check(count, c_n, c_m, k_):
    if count * 2 > c_n or count > c_m: return False
    # 再计算下现在的人数
    if count * 3 + k_ > c_n + c_m: return False
    return True


for _ in range(t):
    n, m, k = map(int, input().split())
    # 上二分
    left = 0
    right = max(n // 2, m) + 1
    ans = left
    while left <= right:
        mid = (left + right) // 2
        if check(mid, n, m, k):
            ans = max(ans, mid)
            left = mid + 1
        else:
            right = mid - 1
    print(ans)
